package com.atguigu.gmall.order.rpc;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.order.biz.OrderBizService;
import com.atguigu.gmall.order.entity.OrderInfo;
import com.atguigu.gmall.order.vo.OrderConfirmVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:lyd
 * @Date:2023/9/4 18:29
 * @Version:1.0
 * @Description
 **/
@RequestMapping("/api/inner/order")
@RestController
public class OrderRpcController {


    @Autowired
    OrderBizService orderBizService;//订单业务处理服务接口

    @GetMapping("/order/confirm/data")
    public Result<OrderConfirmVo> getOrderConfirmData() {
        //TODO 获取订单确认页的数据
        OrderConfirmVo orderConfirmVo = orderBizService.getOrderConfirmData();
        return Result.ok(orderConfirmVo);
    }

    /**
     * 获取订单信息
     * @param orderId
     * @return
     */
    @GetMapping("/orderinfo/{orderId}")
    public Result<OrderInfo> getOrderInfo(@PathVariable Long orderId) {
        OrderInfo orderInfo = orderBizService.getOrderInfo(orderId);
        return Result.ok(orderInfo);
    }
}
